import React, { Fragment } from 'react';
import { connect } from 'dva';
import { Button, Row, Col } from 'antd';
import router from 'umi/router';
import Result from '@/components/Result';
import styles from './style.less';
import { Form } from 'antd/lib/form';

class Step5 extends React.PureComponent {
  state = {
    data: {},
  };

  componentDidMount() {
    console.log(1234);
    this.setState({
      data: JSON.parse(localStorage.getItem('step-res')) || {},
    });
  }

  render() {
    // let data = JSON.parse(localStorage.getItem('step-res'));

    const { data } = this.state;
    const onNext = e => {
      router.push('/preloan/enterprise');
      localStorage.removeItem('step-res');
    };
    const information = (
      <div className={styles.information}>
        <Row>
          <Col xs={24} sm={8} className={styles.label}>
            公司名称：
          </Col>
          <Col xs={24} sm={16}>
            {data.enterpriseName}
          </Col>
        </Row>
        <Row>
          <Col xs={24} sm={8} className={styles.label}>
            公司法人：
          </Col>
          <Col xs={24} sm={16}>
            {data.legalName}
          </Col>
        </Row>
        <Row>
          <Col xs={24} sm={8} className={styles.label}>
            注册资本（万）：
          </Col>
          <Col xs={24} sm={16}>
            {data.capital}
          </Col>
        </Row>
        <Row>
          <Col xs={24} sm={8} className={styles.label}>
            营业地址 ：
          </Col>
          <Col xs={24} sm={16}>
            {data.address}
          </Col>
        </Row>
      </div>
    );
    const actions = (
      <Fragment>
        <Button type="primary" onClick={onNext} style={{ marginLeft: 8 }}>
          完成
        </Button>
      </Fragment>
    );
    return (
      <Result
        type="success"
        title="操作成功"
        description=""
        extra={data ? information : ''}
        actions={actions}
        className={styles.result}
      />
    );
  }
}

export default Step5;
